﻿using System.Collections.Generic;
using WebAPI.Dao;
using WebAPI.Entities;

namespace WebAPI.Services;

public class ClassifyService
{
    private ClassifyMapper _classifyMapper = new ClassifyMapper();
    private TimeTransferUtils _transferUtils = new TimeTransferUtils();
    private IdGenerate _idGenerate = new IdGenerate();
    
    public List<Classify> GetAllClassifies()
    {
        List<Classify> classifies = _classifyMapper.SelectAll();
        
        return classifies;
    }

    public bool AddClassify(Classify classify)
    {
        classify.Id = _idGenerate.GetId();
        
        int flag = _classifyMapper.Insert(classify);
        
        return flag > 0;
    }
    
    public bool UpdateClassify(Classify classify)
    {
        int flag = _classifyMapper.Update(classify);
        
        return flag > 0;
    }
    
    public bool DeleteClassify(Classify classify)
    {
        int flag = _classifyMapper.Delete(classify);
        
        return flag > 0;
    }
}